package com.ccb.afm.util;

import java.io.IOException;

import org.apache.commons.httpclient.HostConfiguration;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;

public class LoginTool {
	
	public void gethouseking()
	{
		//SSL登陆百度
		
		 CodingFactory cfy=new CodingFactory();
		 HttpClient client = new HttpClient();
		 HostConfiguration cf   =     new   HostConfiguration();
		 cf.setHost("baiduhouse.17c.cn");
		 if(ConfigData.isproxy){
		 cf.setProxy( ConfigData.proxyip  ,   ConfigData.proxyport  );
		 }
		 
		 client.setHostConfiguration(cf);
		 GetMethod method = new GetMethod();
		 method.setPath("/apf_houseking/baidu_stable/index.php?c=inbaidu&a=flash_contain&action=index&mid=219038&sesskey=c256c44dd9cccc0079f3ae4483476ff5&isFirstLogin=0&isFirstDayLogin=1&bd_sig_in_iframe=1&bd_sig_method=get&bd_sig_time=1284308052489&bd_sig_added=1&bd_sig_user=2533634957&bd_sig_portrait=7d976c6974657274696765725200&bd_sig_session_key=3bjF%2Fib%2BFcqjx2jidUo9FTNun%2BsJeXt9X7ubmJ8a4%2BB0i2r0SzAiprVK1dCpxhVmXMirnHjhCNCRRkWrNcQOe%2FMid5hdgUmmDikdRGbCiSS5B4CqplKwkg7oGP4992IH5kpNU%2B8hAva1xTbbI4v2GQbgFA2uXoNP3bidaASKKX4t0%2FgrLiWRSfkM%2BHwX1KpDTlC5YU4fMaaxeurTSt1NJfNMz4PmL88cuMMYi05hEBKOHoV%2F8W7Ex%2FCJEEnuDitS&bd_sig_api_key=86c908a6198b130f7b05474c4af8e75f&bd_sig_app_id=10102&bd_sig=0ecb8d7799235345c3e8af2b0f793eb3");
		 method.setRequestHeader("Accept-Encoding","gzip,deflate");
		 method.setRequestHeader("Host","baiduhouse.17c.cn");
		 method.setRequestHeader("User-Agent","Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8");
		 method.setRequestHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
		 method.setRequestHeader("Accept-Language","en-us,zh-cn;q=0.7,zh;q=0.3");
		 method.setRequestHeader("Accept-Charset","GB2312,utf-8;q=0.7,*;q=0.7");
		 method.setRequestHeader("Keep-Alive","115");
		 method.setRequestHeader("Connection","keep-alive");
		 method.setRequestHeader("Referer","http://swf4.17c.cn/hkswf/swf_20100802/Main001.swf");
		 method.setRequestHeader("Content-type","application/x-amf");
		 method.setRequestHeader("Content-length","100");
		 method.setRequestHeader("Cookie", "86c908a6198b130f7b05474c4af8e75f_user=2533634957; 86c908a6198b130f7b05474c4af8e75f_portrait=7d976c6974657274696765725200; 86c908a6198b130f7b05474c4af8e75f_session_key=3bjF%2Fib%2BFcqjx2jidUo9FTNun%2BsJeXt9X7ubmJ8a4%2BB0i2r0SzAiprVK1dCpxhVmXMirnHjhCNCRRkWrNcQOe%2FMid5hdgUmmDikdRGbCiSS5B4CqplKwkg7oGP4992IH5kpNU%2B8hAva1xTbbI4v2GQbgFA2uXoNP3bidaASKKX4t0%2FgrLiWRSfkM%2BHwX1KpDTlC5YU4fMaaxeurTSt1NJfNMz4PmL88cuMMYi05hEBKOHoV%2F8W7Ex%2FCJEEnuDitS; 86c908a6198b130f7b05474c4af8e75f_time=1284304090193; 86c908a6198b130f7b05474c4af8e75f=e44f116719a5a5347e12636c1d3ffa49");
		
		 
		try {
			client.executeMethod(method);
			System.out.println(method.getResponseHeader("Cookie"));
		} catch (HttpException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	public static void main(String []args)
	{
		LoginTool lt=new LoginTool();
		lt.gethouseking();
		
	}

}
